# _*_ coding: UTF-8 _*_
# @Time     : 2022/1/5 15:16
# @Author   : zyz
# @Site     : 1012081978@qq.com
# @File     : cookies_.py
# @Software : PyCharm
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome()
driver.maximize_window()
driver.get('http://www.shopxo.com/shopxo/index.php?s=/index/user/logininfo.html')
driver.find_element(By.NAME, 'accounts').send_keys('zyz')
driver.find_element(By.NAME, 'pwd').send_keys('zyz841968')
time.sleep(10)
driver.find_element(By.XPATH, '/html/body/div[4]/div/div[2]/div[2]/form/div[4]/button').click()
time.sleep(5)
dict1 = driver.get_cookie('PHPSESSID')
driver.quit()
driver = webdriver.Chrome()
driver.maximize_window()
driver.get('http://www.shopxo.com/shopxo/index.php?s=/index/user/logininfo.html')
driver.delete_all_cookies()
driver.add_cookie({'name': dict1['name'], 'value': dict1['value']})
driver.refresh()
time.sleep(15)
driver.quit()